$(document).ready(function(){

		if($("input[name='is_create_module']:radio:checked").val() == '0'){
		document.getElementById("is_create_module_hidden").style.display="";
		}else{
		document.getElementById("is_create_module_hidden").style.display="none";
		}

	
	$("input[name='is_create_module']:radio").change(function(){
	var is_create = $("input[name='is_create_module']:radio:checked").val();
		if(is_create == '0'){
		document.getElementById("is_create_module_hidden").style.display="";
		}else{
		document.getElementById("is_create_module_hidden").style.display="none";
		}
	});
});


function setTopMenu(subsys_code)
{
	Ts_menuinfoInfo.getMenuInfo(subsys_code,function(data){
		DWRUtil.removeAllOptions('top_menu_select');
		DWRUtil.addOptions('top_menu_select',{'':'无上级'});
		DWRUtil.addOptions('top_menu_select',data);
	});
}
function setSecMenu(up_menu_id)
{
	 Ts_menuinfoInfo.getMenuByUpId(up_menu_id,function(data){
		DWRUtil.removeAllOptions('sec_menu_select');
		DWRUtil.addOptions('sec_menu_select',{'':'请选择'});
		DWRUtil.addOptions('sec_menu_select',data);
	});
}

function updateClass(up_menu_id,meneu_class)
{

	$("#sec_menu_select option[value='"+$("#menu_id").val()+"']").remove();
	
	if(up_menu_id == '') {
			if($("#top_menu_select").val() == ""){
				$("#edit_menu_class").text("1");
				$("#menu_class").val("1")			
			} else {
			$("#edit_menu_class").text(parseInt(meneu_class)-1);
			$("#menu_class").val(parseInt(meneu_class)-1);
			}
		} else {
		$("#edit_menu_class").text(meneu_class);
		$("#menu_class").val(meneu_class);
		}
}

function ChangeClassStyle(){
	document.getElementById("up_menu_id").value = "";
	document.getElementById("up_menu_show").style.display="none";
	document.getElementById("up_menu_hidden").style.display="";
}

function formSubmit(){
		var top_menu_id = "";
		if($("#top_menu_select").val()!=""){
			top_menu_id = $("#top_menu_select").val();
			if($("#sec_menu_select").val()!=""){
				top_menu_id = $("#sec_menu_select").val();
			}
		}
		if(top_menu_id==""){
			$("#top_menu_id").val($("#up_menu_id_bak").val());
		}else{
			$("#up_menu_id").val(top_menu_id);
		}	
		var ss = document.getElementById("module_dir").value;
        if(ss!="") 
           if(!checkAddr(ss)) return false;
     
        var pp = document.getElementById("module_name").value;
      //  if(pp!=null)
      //     if(!checkDBName(pp)) return false;
       // return false;
	    document.addForm.submit();

}
function checkAddr(vg){
			var str=/^[A-Za-z/\/]+$/;
			if(str.test(vg)){
			//	alert('格式正确');
				return true;
			}else{
				alert('页面地址格式不正确 必填！');
				return false;
			}
			return true;
		}
function checkDBName(pp){
     var aa = /[t][bis][_][a-z]+$/; 
     if(!aa.test(pp)){
      alert("菜单模型名称不正确");
      return false;
      }
      return true;
}  

